package com.getan.boot.jdbc.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 逻辑删除实体基类
 *
 * @author Bruce.Gong
 * @since 1.0.0-SNAPSHOT
 */
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
@Data
public abstract class LogicEntity extends GenericEntity {

    public static String DELETE_SQL = "deleted = 1";

    /**
     * 逻辑删除，0否1是
     */
    @TableLogic(delval = "1", value = "0")
    @TableField(fill = FieldFill.INSERT, select = false)
    private Boolean deleted;

}
